import 'package:flutter/material.dart';

//chart
import '../pages/chart_demo_list_page.dart';
import '../pages/chart_page1.dart';
import '../pages/chart_page2.dart';
import '../pages/eChart_page1.dart';
import '../pages/eChart_page2.dart';
import '../pages/eChart_page3.dart';
import '../pages/eChart_page4.dart';
import '../pages/mpChart_line_page1.dart';
import '../pages/mpChart_bar_page1.dart';
import '../pages/mpChart_combined_page.dart';





final String home = '/';
final String loginPage = 'LoginPage';
final String onePage = '/onePage';
final String twoPage = '/twoPage';
final String threePage = '/threePage';
final String fourPage = '/fourPage';

final String demoListsPage = 'DemoListsPage';

// 配置路由命名信息
final routes = {

  
  //chart
  "ChartDemoListPage": (context) => ChartDemoListPage(),
  "ChartPage1": (context) => ChartPage1(),
  "ChartPage2": (context) => ChartPage2(),
  "EChartPage1": (context) => EChartPage1(),
  "EChartPage2": (context) => EChartPage2(),
  "EChartPage3": (context) => EChartPage3(),
  "EChartPage4": (context) => EChartPage4(),
  "MpChartLinePage1": (context) => MpChartLinePage1(),
  "MpChartBarPage1": (context) => MpChartBarPage1(),
  "MpChartCombinedPage": (context) => MpChartCombinedPage(),






};

class UnknownPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('跳转错误'),
        centerTitle: true,
      ),
    );
  }
}


//固定写法
var    onGenerateRoute=(RouteSettings settings) {
// 统一处理
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context,
                  arguments: settings.arguments));
      return route;
    } else {
      final Route route = MaterialPageRoute(
          builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};

